//
//  CZStatusCell.swift
//  sinaWeiboswift
//
//  Created by 段文杰 on 16/4/14.
//  Copyright © 2016年 段文杰. All rights reserved.
//

import UIKit
import SnapKit
class CZStatusCell: UITableViewCell {

    
    var status : CZStatusModel? {
        didSet{//将VC的status值再一次传递给oringnaView
            HMPrint(status)
        oringinaView.status = status
        
        }
    
    }
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: .Default, reuseIdentifier: "cell")
        
        self.backgroundColor = UIColor.init(red: ( CGFloat(arc4random_uniform(256)) / 255.0), green: ( CGFloat(arc4random_uniform(256)) / 255.0), blue: ( CGFloat(arc4random_uniform(256)) / 255.0), alpha: 1.0)
//        self.backgroundColor = UIColor(white: 237.0 / 255.0, alpha: 1)

        setUI()
    }
    
    private func setUI(){
    
        //添加子控件
       self.contentView.addSubview(oringinaView)
    
        self.contentView.addSubview(botomView)
        //设置约束
        oringinaView.snp_makeConstraints { (make) in
            make.leading.trailing.equalTo(contentView)
            make.top.equalTo(contentView).offset(10)
            // 高度参照子控件的高度
//        make.height.equalTo(Int(arc4random_uniform(200)) + 50)
        }

        
        //设置botoViewframe值
        botomView.snp_makeConstraints { (make) in
            make.leading.trailing.equalTo(contentView)
            make.top.equalTo(oringinaView.snp_bottom)
            make.height.equalTo(40)
        }
    
        contentView.snp_makeConstraints { (make) in
            make.leading.trailing.top.equalTo(self)
           
//            make.height.equalTo(oringinaView).offset(10)
            make.bottom.equalTo(botomView)
        }
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    

    
    // MARK: - ******************* #懒加载# ********************
    
    
    private lazy var oringinaView :CZStatusoriginnaView = CZStatusoriginnaView()
    private lazy var botomView : CZStatusBottomView = CZStatusBottomView()
    
}



